package com.ly.mpayment.core.util;

import com.ly.mpayment.persist.entity.User;

public class UserUtil {

	/**
	 *  管理员和超级管理员 
	 * @param user
	 * @return
	 */
	public static boolean checkRole (User user){
		if(user.getUsertype() == 1 || user.getUsertype() == 2){
			 return true;
		}
		return false;
	}
	
	/**
	 *  管理员和超级管理员  下游
	 * @param user
	 * @return
	 */
	public static boolean checkRoleAll (User user){
		if(user.getUsertype() == 1 || user.getUsertype() == 2 || user.getUsertype() == 3 || user.getUsertype() == 5){
			 return true;
		}
		return false;
	}
	
	/**
	 *  管理员
	 * @param user
	 * @return
	 */
	public static boolean checkRoleAdmin (User user){
		if(user.getUsertype() == 1 ){
			 return true;
		}
		return false;
	}
	

	/**
	 *  下游用户
	 * @param user
	 * @return
	 */
	public static boolean checkRoleDown (User user){
		if(user.getUsertype() == 3 ){
			 return true;
		}
		return false;
	}
	
	
	/**
	 *  上游用户
	 * @param user
	 * @return
	 */
	public static boolean checkRoleUp(User user){
		if(user.getUsertype() == 4 ){
			 return true;
		}
		return false;
	}
	/**
	 *  超级管理员
	 * @param user
	 * @return
	 */
	public static boolean checkRoleSupper (User user){
		if(user.getUsertype() == 2 ){
			 return true;
		}
		return false;
	}
	
	/**
	 *  上游用户
	 * @param user
	 * @return
	 */
	public static boolean checkBroadband(User user){
		if(user.getUsertype() == 5 ){
			 return true;
		}
		return false;
	}
	
	public static boolean checkSlow(User user){
		if(user.getUsertype() == 6 ){
			 return true;
		}
		return false;
	}
}
